1. Field of the Invention
The present invention relates to an apparatus and method to enhance a contrast using a histogram matching, and more particularly, to an apparatus and method to enhance a contrast of an output image using a mapping table written based on a distribution of an input image and a target image.
2. Description of the Related Art
A histogram is to express a distribution of contrast values of pixels of an image. In other words, the histogram expresses a distribution range and values of light points and dark points existing in the image. A smoothness of the histogram makes uniform the distribution of the contrast values with a biased image or a non-uniform image, to thereby enhance the image. Through the smoothness of the histogram, a dark image becomes light, and a too light image becomes dark slightly, thereby maintaining a proper lightness. In other words, by correcting the distribution of the lightness values after the conversion, a contrast balance of the image is improved.
FIG. 1A is a block diagram of a conventional histogram smoothing apparatus 100. Referring to FIG. 1A, the conventional histogram smoothing apparatus 100 includes a distribution operation part 110 and a smoothing part 120.
The distribution operation part 110 counts a lightness level from an input image to thereby obtain a histogram value or a probability density function, and calculates a cumulative distribution function from the obtained histogram value and the probability density function. The smoothing part 120 makes uniform the histogram of a given image using the cumulative distribution function calculated by the distribution operation part 110. As a consequence, the cumulative distribution function is non-linearly mapped with the given image, so that the contrast of the image is enhanced.
FIG. 1B is a block diagram of a conventional contrast stretching apparatus 150. Referring to FIG. 1B, the conventional contrast stretching apparatus 150 includes a distribution operation part 160 and a stretching part 170.
The distribution operation part 160 counts a lightness level from the image to thereby obtain the histogram value or the probability density function. The stretching part 170 obtains a pixel value having a lowest value and a highest value using the probability density function obtained by the distribution operation part 160, and displays the histogram using the obtained pixel values so as to utilize the distribution of the contrast values of the image to a maximum extent.
By performing a subtraction operation using the pixel value having the lowest value in the image, the histogram is moved toward a left of the image. At this time, the respective pixel values of the image are extended so as to include the entire contrast values. Accordingly, the image comes to have the contrast values from 0 to 255, so that the contrast of the image increases.
However, the conventional histogram smoothing has drawbacks such as being difficult to control a degree of the contrast enhancement. The conventional histogram utilizes the probability density function and the cumulative distribution function obtained from the given image as a mapping to enhance the contrast. Thus, in case that the given image has a special property or is damaged due to noises, it is not easy to obtain a desired result.
Also, the conventional histogram smoothing fails to maintain a relative brightness. The brightness of the image obtained through the histogram smoothing has no relation with the brightness of the given image. So, in case that the conventional histogram smoothing is applied to a video sequence, a discrimination of a light scene and a dark scene disappears. The conventional histogram smoothing can be effectively performed when it is applied to the image having fineness in a dark portion of the image. On the contrary, the image having a good quality becomes bad. In order to overcome the aforementioned drawbacks, complicated algorithms have been provided making it difficult to realize such a device.
Meanwhile, in case of the conventional contrast stretching technology, if there exists a light portion or a dark portion in the image, a margin of the stretching is not secured, making it difficult to anticipate a good result.